package org.etherframework.tests.features.mediator.mediators
{
	import org.etherframework.common.DestructionPolicy;
	import org.etherframework.common.IStatefulDestroyable;
	import org.etherframework.common.IWeaklyDestroyable;
	import org.etherframework.mediator.Mediator;
	import org.etherframework.tests.features.mediator.events.SomeEvent;
	
	public class WeaklyDestroyableMediator extends Mediator implements IWeaklyDestroyable, IStatefulDestroyable
	{
		public var completeCounter:int = 0;
		public var initCounter:int = 0;
		public var eventCounter:int = 0;
		
		private var _detached:Boolean;
		private var _destructionPolicy:String = DestructionPolicy.DETACH;
		private var _destroyed:Boolean;
		
		override public function initiate():void
		{
			initCounter++;
			ether.listen(SomeEvent.SOME, someEventHandler);
		}
		
		private function someEventHandler(event:SomeEvent):void
		{
			eventCounter++;
		}
		
		override public function complete():void
		{
			completeCounter++;
		}
		
		public function attach():void
		{
		}
		
		public function detach():void
		{
		}
		
		public function destroy():void
		{
		}
		
		public function get destructionPolicy():String { return _destructionPolicy; }
		public function set destructionPolicy(value:String):void { _destructionPolicy = value; }
		
		public function get detached():Boolean { return _detached; }
		public function set detached(value:Boolean):void { _detached = value; }
		
		public function get destroyed():Boolean { return _destroyed; }
		public function set destroyed(value:Boolean):void { _destroyed = value; }
	}
}